<script>
	const httpRequest = require("@/common/httpRequest.js")
import WebSocket from '@/static/websocket.js' //websocket封装
	export default {
		data(){
			return {
				websocket:null
			}
		},
		globalData:{
			videopage:""
		},
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function() {
			if (httpRequest.checkIsLogin()) { //已经登陆,创建websocket连接
				this.websocketStart()
			}
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
			this.websocket.close()
		},
		methods: {
			websocketStart() {
				this.websocket = new WebSocket("wss://fun6688.fun:8383");
				this.websocket.connect()
				this.websocket.onMessage(result => {
					console.log('app.js收到服務器内容：' +result.data);
					uni.$emit('updatechatFn', "")
					uni.$emit('updatechatFnList', "")
				})
			},
			
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	@import "colorui/main.css";
	@import "colorui/icon.css";
	
	@import url("static/css/main1.css");
	@import url("static/css/last.scss");

	page {
		background-color: #100d1f;
	}

	.grbox {
		background-color: #3E3B4A;
		border-radius: 6rpx;
		width: 37%;
	}

	.honbtn {
		width: 106rpx;
		height: 46rpx;
		background: #DD5056;
		border-radius: 23rpx 23rpx 23rpx 23rpx;
		font-size: 24rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}

	.grtoux {
		width: 98rpx;
		height: 98rpx;
		border-radius: 50%
	}
</style>